package com.softwareengineering.trafficapplicationv2;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;

/**
 * This file is part of the Traffic Simulation Application. The Traffic
 * Simulation Application is free software: you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or (at your
 * option) any later version.
 * 
 * The Traffic Simulation Application is distributed in the hope that it will be
 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
 * Public License for more details. You should have received a copy of the GNU
 * General Public License along with the Traffic Simulation Application. If not,
 * see <http://www.gnu.org/licenses/>.
 * 
 * @file ActivityLaunch.java
 * @author David Black, Chris Nelson, and Garrett Stibbs, (c) December 03, 2012
 * @description ActivityLaunch handles launch activity w/ menu selection
 * 
 * @revised by Gwen Nellen
 * @description ActivityLaunch now launches the about and instruction activity
 */

public class ActivityLaunch extends Activity implements Constants,
		OnClickListener {

	// #####################################
	// ActivityLaunch Member Methods
	// #####################################

	// launches Levels activity
	private void doLaunchLevels() {
		// start ActivityLevels activity
		startActivity(new Intent(this, ActivityLevels.class)); 
		finish(); // finish this activity to minimize stack use
	}
	// launches About activity
	private void doAbout() {
		startActivity(new Intent(this, ActivityAbout.class));
		finish();
	}
	// launches Instruction activity
		private void doInstruct() {
			startActivity(new Intent(this, ActivityInstruction.class));
			finish();
		}
	// #################
	// Listeners
	// #################

	@Override
	// handles onClick events
	public void onClick(View view) {

		switch (view.getId()) { // direct according to View Id

		case R.id.button_levels: // Play Game! button

			doLaunchLevels(); // launch Levels activity
			break;
		case R.id.button_about: // launch About activity
			doAbout();
			break;
		case R.id.button_instructions: // launch Instruction activity
			doInstruct();
			break;
			
		}

	}

	@Override
	// handles onCreate event
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState); // call super
		setContentView(R.layout.activity_launch); // set appropriate layout
	}
	

}
